<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Origami::ContentStream</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Origami::ContentStream</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../files/origami/graphics/xobject_rb.html">
                origami/graphics/xobject.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                <a href="Stream.html">
                Stream
               </a>
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
A class representing a <a href="Stream.html">Stream</a> containing the
contents of a <a href="Page.html">Page</a>.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000600">draw_line</a>&nbsp;&nbsp;
      <a href="#M000601">draw_polygon</a>&nbsp;&nbsp;
      <a href="#M000602">draw_rectangle</a>&nbsp;&nbsp;
      <a href="#M000599">instructions</a>&nbsp;&nbsp;
      <a href="#M000598">new</a>&nbsp;&nbsp;
      <a href="#M000604">paint_shading</a>&nbsp;&nbsp;
      <a href="#M000615">set_dash_pattern</a>&nbsp;&nbsp;
      <a href="#M000613">set_fill_color</a>&nbsp;&nbsp;
      <a href="#M000617">set_line_cap</a>&nbsp;&nbsp;
      <a href="#M000618">set_line_join</a>&nbsp;&nbsp;
      <a href="#M000616">set_line_width</a>&nbsp;&nbsp;
      <a href="#M000614">set_stroke_color</a>&nbsp;&nbsp;
      <a href="#M000612">set_text_char_spacing</a>&nbsp;&nbsp;
      <a href="#M000605">set_text_font</a>&nbsp;&nbsp;
      <a href="#M000607">set_text_leading</a>&nbsp;&nbsp;
      <a href="#M000606">set_text_pos</a>&nbsp;&nbsp;
      <a href="#M000608">set_text_rendering</a>&nbsp;&nbsp;
      <a href="#M000609">set_text_rise</a>&nbsp;&nbsp;
      <a href="#M000610">set_text_scale</a>&nbsp;&nbsp;
      <a href="#M000611">set_text_word_spacing</a>&nbsp;&nbsp;
      <a href="#M000603">write</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">


    <div id="constants-list">
      <h3 class="section-bar">Constants</h3>

      <div class="name-list">
        <table summary="Constants">
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_SIZE</td>
          <td>=</td>
          <td class="context-item-value">12</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_FONT</td>
          <td>=</td>
          <td class="context-item-value">:F1</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_LEADING</td>
          <td>=</td>
          <td class="context-item-value">20</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_STROKE_COLOR</td>
          <td>=</td>
          <td class="context-item-value">Graphics::Color::GrayScale.new(0.0)</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_FILL_COLOR</td>
          <td>=</td>
          <td class="context-item-value">Graphics::Color::GrayScale.new(1.0)</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_LINECAP</td>
          <td>=</td>
          <td class="context-item-value">Graphics::LineCapStyle::BUTT_CAP</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_LINEJOIN</td>
          <td>=</td>
          <td class="context-item-value">Graphics::LineJoinStyle::MITER_JOIN</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_DASHPATTERN</td>
          <td>=</td>
          <td class="context-item-value">Graphics::DashPattern.new([], 0)</td>
        </tr>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">DEFAULT_LINEWIDTH</td>
          <td>=</td>
          <td class="context-item-value">1.0</td>
        </tr>
        </table>
      </div>
    </div>



    <div id="attribute-list">
      <h3 class="section-bar">Attributes</h3>

      <div class="name-list">
        <table>
        <tr class="top-aligned-row context-row">
          <td class="context-item-name">instructions</td>
          <td class="context-item-value">&nbsp;[R]&nbsp;</td>
          <td class="context-item-desc"></td>
        </tr>
        </table>
      </div>
    </div>
      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000598" class="method-detail">
        <a name="M000598"></a>

        <div class="method-heading">
          <a href="#M000598" class="method-signature">
          <span class="method-name">new</span><span class="method-args">(rawdata = &quot;&quot;, dictionary = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000598-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000598-source">
<pre>
    <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 45</span>
45:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">rawdata</span> = <span class="ruby-value str">&quot;&quot;</span>, <span class="ruby-identifier">dictionary</span> = {})
46:     
47:       <span class="ruby-ivar">@instructions</span> = <span class="ruby-keyword kw">nil</span>
48:       <span class="ruby-ivar">@gs</span> = <span class="ruby-constant">Graphics</span><span class="ruby-operator">::</span><span class="ruby-constant">State</span>.<span class="ruby-identifier">new</span>
49: 
50:       <span class="ruby-keyword kw">super</span>(<span class="ruby-identifier">rawdata</span>, <span class="ruby-identifier">dictionary</span>)
51:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000600" class="method-detail">
        <a name="M000600"></a>

        <div class="method-heading">
          <a href="#M000600" class="method-signature">
          <span class="method-name">draw_line</span><span class="method-args">(from, to, attr = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Draw a straight line from the point at coord <em>from</em>, to the point at
coord <em>to</em>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000600-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000600-source">
<pre>
    <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 73</span>
73:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_line</span>(<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>, <span class="ruby-identifier">attr</span> = {})
74:       <span class="ruby-identifier">draw_polygon</span>([<span class="ruby-identifier">from</span>, <span class="ruby-identifier">to</span>], <span class="ruby-identifier">attr</span>)
75:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000601" class="method-detail">
        <a name="M000601"></a>

        <div class="method-heading">
          <a href="#M000601" class="method-signature">
          <span class="method-name">draw_polygon</span><span class="method-args">(coords = [], attr = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Draw a polygon from a array of coordinates.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000601-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000601-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 80</span>
 80:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_polygon</span>(<span class="ruby-identifier">coords</span> = [], <span class="ruby-identifier">attr</span> = {})
 81:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
 82: 
 83:       <span class="ruby-identifier">stroke_color</span>  = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:stroke_color</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_STROKE_COLOR</span>
 84:       <span class="ruby-identifier">fill_color</span>    = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:fill_color</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_FILL_COLOR</span>
 85:       <span class="ruby-identifier">line_cap</span>      = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:line_cap</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LINECAP</span>
 86:       <span class="ruby-identifier">line_join</span>     = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:line_join</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LINEJOIN</span>
 87:       <span class="ruby-identifier">line_width</span>    = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:line_width</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LINEWIDTH</span>
 88:       <span class="ruby-identifier">dash_pattern</span>  = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:dash</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_DASHPATTERN</span>
 89: 
 90:       <span class="ruby-identifier">stroke</span>        = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:stroke</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:stroke</span>]
 91:       <span class="ruby-identifier">fill</span>          = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:fill</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">false</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:fill</span>]
 92: 
 93:       <span class="ruby-identifier">stroke</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fill</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">stroke</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span> 
 94: 
 95:       <span class="ruby-identifier">set_fill_color</span>(<span class="ruby-identifier">fill_color</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fill</span>
 96:       <span class="ruby-identifier">set_stroke_color</span>(<span class="ruby-identifier">stroke_color</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stroke</span>
 97:       <span class="ruby-identifier">set_line_width</span>(<span class="ruby-identifier">line_width</span>)
 98:       <span class="ruby-identifier">set_line_cap</span>(<span class="ruby-identifier">line_cap</span>)
 99:       <span class="ruby-identifier">set_line_join</span>(<span class="ruby-identifier">line_join</span>)
100:       <span class="ruby-identifier">set_dash_pattern</span>(<span class="ruby-identifier">dash_pattern</span>)
101:    
102:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">is_in_text_object?</span>
103:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'ET'</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
104:       <span class="ruby-keyword kw">end</span>
105: 
106:       <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">coords</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">&lt;</span> <span class="ruby-value">1</span>
107:         <span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span> = <span class="ruby-identifier">coords</span>.<span class="ruby-identifier">slice!</span>(<span class="ruby-value">0</span>)
108:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'m'</span>,<span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
109: 
110:         <span class="ruby-identifier">coords</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">px</span>,<span class="ruby-identifier">py</span><span class="ruby-operator">|</span>
111:           <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'l'</span>,<span class="ruby-identifier">px</span>,<span class="ruby-identifier">py</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
112:         <span class="ruby-keyword kw">end</span>
113: 
114:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">i</span> =
115:           <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stroke</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">fill</span>
116:             <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'s'</span>)
117:           <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">fill</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">stroke</span>
118:             <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'f'</span>)
119:           <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">fill</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">stroke</span>
120:             <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'b'</span>)
121:           <span class="ruby-keyword kw">end</span>
122:         )
123: 
124:         <span class="ruby-identifier">i</span>.<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
125:       <span class="ruby-keyword kw">end</span>
126: 
127:       <span class="ruby-keyword kw">self</span>
128:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000602" class="method-detail">
        <a name="M000602"></a>

        <div class="method-heading">
          <a href="#M000602" class="method-signature">
          <span class="method-name">draw_rectangle</span><span class="method-args">(x, y, width, height, attr = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Draw a rectangle at position (<em>x</em>,<em>y</em>) with defined
<em>width</em> and <em>height</em>.
</p>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000602-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000602-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 133</span>
133:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">draw_rectangle</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>, <span class="ruby-identifier">width</span>, <span class="ruby-identifier">height</span>, <span class="ruby-identifier">attr</span> = {})
134:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
135: 
136:       <span class="ruby-identifier">stroke_color</span>  = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:stroke_color</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_STROKE_COLOR</span>
137:       <span class="ruby-identifier">fill_color</span>    = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:fill_color</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_FILL_COLOR</span>
138:       <span class="ruby-identifier">line_cap</span>      = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:line_cap</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LINECAP</span>
139:       <span class="ruby-identifier">line_join</span>     = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:line_join</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LINEJOIN</span>
140:       <span class="ruby-identifier">line_width</span>    = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:line_width</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LINEWIDTH</span>
141:       <span class="ruby-identifier">dash_pattern</span>  = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:dash</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_DASHPATTERN</span>
142: 
143:       <span class="ruby-identifier">stroke</span>        = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:stroke</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">true</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:stroke</span>]
144:       <span class="ruby-identifier">fill</span>          = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:fill</span>].<span class="ruby-identifier">nil?</span> <span class="ruby-value">? </span><span class="ruby-keyword kw">false</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:fill</span>]
145: 
146:       <span class="ruby-identifier">stroke</span> = <span class="ruby-keyword kw">true</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fill</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">stroke</span> <span class="ruby-operator">==</span> <span class="ruby-keyword kw">false</span> 
147: 
148:       <span class="ruby-identifier">set_fill_color</span>(<span class="ruby-identifier">fill_color</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fill</span>
149:       <span class="ruby-identifier">set_stroke_color</span>(<span class="ruby-identifier">stroke_color</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stroke</span>
150:       <span class="ruby-identifier">set_line_width</span>(<span class="ruby-identifier">line_width</span>)
151:       <span class="ruby-identifier">set_line_cap</span>(<span class="ruby-identifier">line_cap</span>)
152:       <span class="ruby-identifier">set_line_join</span>(<span class="ruby-identifier">line_join</span>)
153:       <span class="ruby-identifier">set_dash_pattern</span>(<span class="ruby-identifier">dash_pattern</span>)
154: 
155:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">is_in_text_object?</span>
156:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'ET'</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
157:       <span class="ruby-keyword kw">end</span>
158: 
159:       <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'re'</span>, <span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span>,<span class="ruby-identifier">width</span>,<span class="ruby-identifier">height</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
160:   
161:       <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> (<span class="ruby-identifier">i</span> =
162:         <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">stroke</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">fill</span>
163:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'S'</span>)
164:         <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">fill</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">stroke</span>
165:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'f'</span>)
166:         <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">fill</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">stroke</span>
167:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'B'</span>)
168:         <span class="ruby-keyword kw">end</span>
169:       )
170: 
171:       <span class="ruby-identifier">i</span>.<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
172:       
173:       <span class="ruby-keyword kw">self</span>
174:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000599" class="method-detail">
        <a name="M000599"></a>

        <div class="method-heading">
          <a href="#M000599" class="method-signature">
          <span class="method-name">instructions</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000599-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000599-source">
<pre>
    <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 64</span>
64:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">instructions</span>
65:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
66: 
67:       <span class="ruby-ivar">@instructions</span>
68:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000604" class="method-detail">
        <a name="M000604"></a>

        <div class="method-heading">
          <a href="#M000604" class="method-signature">
          <span class="method-name">paint_shading</span><span class="method-args">(shade)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000604-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000604-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 220</span>
220:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">paint_shading</span>(<span class="ruby-identifier">shade</span>)
221:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
222:       <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'sh'</span>, <span class="ruby-identifier">shade</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
223: 
224:       <span class="ruby-keyword kw">self</span>
225:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000615" class="method-detail">
        <a name="M000615"></a>

        <div class="method-heading">
          <a href="#M000615" class="method-signature">
          <span class="method-name">set_dash_pattern</span><span class="method-args">(pattern)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000615-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000615-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 357</span>
357:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_dash_pattern</span>(<span class="ruby-identifier">pattern</span>)
358:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
359:       <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">dash_pattern</span>.<span class="ruby-identifier">eql?</span> <span class="ruby-identifier">pattern</span>
360:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'d'</span>, <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">array</span>, <span class="ruby-identifier">pattern</span>.<span class="ruby-identifier">phase</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
361:       <span class="ruby-keyword kw">end</span>
362: 
363:       <span class="ruby-keyword kw">self</span>
364:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000613" class="method-detail">
        <a name="M000613"></a>

        <div class="method-heading">
          <a href="#M000613" class="method-signature">
          <span class="method-name">set_fill_color</span><span class="method-args">(color)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000613-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000613-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 297</span>
297:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_fill_color</span>(<span class="ruby-identifier">color</span>)
298:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
299:       
300:       <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> ( <span class="ruby-identifier">i</span> =
301:         <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:r</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:g</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:b</span>) <span class="ruby-keyword kw">or</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Array</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span>)
302:           <span class="ruby-identifier">r</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:r</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">r</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">255</span>
303:           <span class="ruby-identifier">g</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:g</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">g</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">1</span>]).<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">255</span>
304:           <span class="ruby-identifier">b</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:b</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">b</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">2</span>]).<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">255</span>
305:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'rg'</span>, <span class="ruby-identifier">r</span>, <span class="ruby-identifier">g</span>, <span class="ruby-identifier">b</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">nonstroking_color</span> <span class="ruby-operator">!=</span> [<span class="ruby-identifier">r</span>,<span class="ruby-identifier">g</span>,<span class="ruby-identifier">b</span>]
306: 
307:         <span class="ruby-keyword kw">elsif</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:c</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:m</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:y</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:k</span>) <span class="ruby-keyword kw">or</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Array</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span>)
308:           <span class="ruby-identifier">c</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:c</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">c</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">to_f</span>
309:           <span class="ruby-identifier">m</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:m</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">m</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">1</span>]).<span class="ruby-identifier">to_f</span>
310:           <span class="ruby-identifier">y</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:y</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">2</span>]).<span class="ruby-identifier">to_f</span>
311:           <span class="ruby-identifier">k</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:k</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">k</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">3</span>]).<span class="ruby-identifier">to_f</span>
312:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'k'</span>, <span class="ruby-identifier">c</span>, <span class="ruby-identifier">m</span>, <span class="ruby-identifier">y</span>, <span class="ruby-identifier">k</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">nonstroking_color</span> <span class="ruby-operator">!=</span> [<span class="ruby-identifier">c</span>,<span class="ruby-identifier">m</span>,<span class="ruby-identifier">y</span>,<span class="ruby-identifier">k</span>]
313:           
314:         <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span><span class="ruby-identifier">:g</span> <span class="ruby-keyword kw">or</span> (<span class="ruby-value">0</span><span class="ruby-value">.0</span><span class="ruby-operator">..</span><span class="ruby-value">1.0</span>) <span class="ruby-operator">===</span> <span class="ruby-identifier">color</span> 
315:           <span class="ruby-identifier">g</span> = <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:g</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">g</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>
316:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'g'</span>, <span class="ruby-identifier">g</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">nonstroking_color</span> <span class="ruby-operator">!=</span> [ <span class="ruby-identifier">g</span> ]
317: 
318:         <span class="ruby-keyword kw">else</span>
319:           <span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">&quot;Invalid color : #{color}&quot;</span>
320:         <span class="ruby-keyword kw">end</span>
321:       )
322: 
323:       <span class="ruby-identifier">i</span>.<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span>
324:       <span class="ruby-keyword kw">self</span> 
325:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000617" class="method-detail">
        <a name="M000617"></a>

        <div class="method-heading">
          <a href="#M000617" class="method-signature">
          <span class="method-name">set_line_cap</span><span class="method-args">(cap)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000617-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000617-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 375</span>
375:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_line_cap</span>(<span class="ruby-identifier">cap</span>)
376:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
377:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">line_cap</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">cap</span>
378:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'J'</span>, <span class="ruby-identifier">cap</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
379:       <span class="ruby-keyword kw">end</span>
380: 
381:       <span class="ruby-keyword kw">self</span>
382:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000618" class="method-detail">
        <a name="M000618"></a>

        <div class="method-heading">
          <a href="#M000618" class="method-signature">
          <span class="method-name">set_line_join</span><span class="method-args">(join)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000618-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000618-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 384</span>
384:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_line_join</span>(<span class="ruby-identifier">join</span>)
385:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
386:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">line_join</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">join</span>
387:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'j'</span>, <span class="ruby-identifier">join</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
388:       <span class="ruby-keyword kw">end</span>
389: 
390:       <span class="ruby-keyword kw">self</span>
391:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000616" class="method-detail">
        <a name="M000616"></a>

        <div class="method-heading">
          <a href="#M000616" class="method-signature">
          <span class="method-name">set_line_width</span><span class="method-args">(width)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000616-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000616-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 366</span>
366:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_line_width</span>(<span class="ruby-identifier">width</span>)
367:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
368:       <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">line_width</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">width</span>
369:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'w'</span>, <span class="ruby-identifier">width</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
370:       <span class="ruby-keyword kw">end</span>
371: 
372:       <span class="ruby-keyword kw">self</span>
373:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000614" class="method-detail">
        <a name="M000614"></a>

        <div class="method-heading">
          <a href="#M000614" class="method-signature">
          <span class="method-name">set_stroke_color</span><span class="method-args">(color)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000614-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000614-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 327</span>
327:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_stroke_color</span>(<span class="ruby-identifier">color</span>)
328:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
329:       
330:       <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> ( <span class="ruby-identifier">i</span> =
331:         <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:r</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:g</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:b</span>) <span class="ruby-keyword kw">or</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Array</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">3</span>)
332:           <span class="ruby-identifier">r</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:r</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">r</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">255</span>
333:           <span class="ruby-identifier">g</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:g</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">g</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">1</span>]).<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">255</span>
334:           <span class="ruby-identifier">b</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:b</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">b</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">2</span>]).<span class="ruby-identifier">to_f</span> <span class="ruby-operator">/</span> <span class="ruby-value">255</span>
335:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'RG'</span>, <span class="ruby-identifier">r</span>, <span class="ruby-identifier">g</span>, <span class="ruby-identifier">b</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">stroking_color</span> <span class="ruby-operator">!=</span> [<span class="ruby-identifier">r</span>,<span class="ruby-identifier">g</span>,<span class="ruby-identifier">b</span>]
336: 
337:         <span class="ruby-keyword kw">elsif</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:c</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:m</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:y</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span> <span class="ruby-identifier">:k</span>) <span class="ruby-keyword kw">or</span> (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">is_a?</span>(<span class="ruby-operator">::</span><span class="ruby-constant">Array</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">size</span> <span class="ruby-operator">==</span> <span class="ruby-value">4</span>)
338:           <span class="ruby-identifier">c</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:c</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">c</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">0</span>]).<span class="ruby-identifier">to_f</span>
339:           <span class="ruby-identifier">m</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:m</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">m</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">1</span>]).<span class="ruby-identifier">to_f</span>
340:           <span class="ruby-identifier">y</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:y</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">y</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">2</span>]).<span class="ruby-identifier">to_f</span>
341:           <span class="ruby-identifier">k</span> = (<span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:k</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">k</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>[<span class="ruby-value">3</span>]).<span class="ruby-identifier">to_f</span>
342:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'K'</span>, <span class="ruby-identifier">c</span>, <span class="ruby-identifier">m</span>, <span class="ruby-identifier">y</span>, <span class="ruby-identifier">k</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">stroking_color</span> <span class="ruby-operator">!=</span> [<span class="ruby-identifier">c</span>,<span class="ruby-identifier">m</span>,<span class="ruby-identifier">y</span>,<span class="ruby-identifier">k</span>]
343:           
344:         <span class="ruby-keyword kw">elsif</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span><span class="ruby-identifier">:g</span> <span class="ruby-keyword kw">or</span> (<span class="ruby-value">0</span><span class="ruby-value">.0</span><span class="ruby-operator">..</span><span class="ruby-value">1.0</span>) <span class="ruby-operator">===</span> <span class="ruby-identifier">color</span> 
345:           <span class="ruby-identifier">g</span> = <span class="ruby-identifier">color</span>.<span class="ruby-identifier">respond_to?</span>(<span class="ruby-identifier">:g</span>) <span class="ruby-operator">?</span> <span class="ruby-identifier">color</span>.<span class="ruby-identifier">g</span> <span class="ruby-operator">:</span> <span class="ruby-identifier">color</span>
346:           <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'G'</span>, <span class="ruby-identifier">g</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">stroking_color</span> <span class="ruby-operator">!=</span> [ <span class="ruby-identifier">g</span> ]
347: 
348:         <span class="ruby-keyword kw">else</span>
349:           <span class="ruby-identifier">raise</span> <span class="ruby-constant">TypeError</span>, <span class="ruby-node">&quot;Invalid color : #{color}&quot;</span>
350:         <span class="ruby-keyword kw">end</span>
351:       )
352: 
353:       <span class="ruby-identifier">i</span>.<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">i</span>
354:       <span class="ruby-keyword kw">self</span> 
355:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000612" class="method-detail">
        <a name="M000612"></a>

        <div class="method-heading">
          <a href="#M000612" class="method-signature">
          <span class="method-name">set_text_char_spacing</span><span class="method-args">(char_spacing)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000612-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000612-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 288</span>
288:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_text_char_spacing</span>(<span class="ruby-identifier">char_spacing</span>)
289:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
290:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">char_spacing</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">char_spacing</span>
291:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Tc'</span>, <span class="ruby-identifier">char_spacing</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
292:       <span class="ruby-keyword kw">end</span>
293: 
294:       <span class="ruby-keyword kw">self</span>
295:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000605" class="method-detail">
        <a name="M000605"></a>

        <div class="method-heading">
          <a href="#M000605" class="method-signature">
          <span class="method-name">set_text_font</span><span class="method-args">(fontname, size)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000605-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000605-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 227</span>
227:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_text_font</span>(<span class="ruby-identifier">fontname</span>, <span class="ruby-identifier">size</span>)
228:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
229:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">fontname</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">font</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">size</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">font_size</span>
230:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Tf'</span>, <span class="ruby-identifier">fontname</span>, <span class="ruby-identifier">size</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
231:       <span class="ruby-keyword kw">end</span>
232: 
233:       <span class="ruby-keyword kw">self</span>
234:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000607" class="method-detail">
        <a name="M000607"></a>

        <div class="method-heading">
          <a href="#M000607" class="method-signature">
          <span class="method-name">set_text_leading</span><span class="method-args">(leading)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000607-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000607-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 243</span>
243:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_text_leading</span>(<span class="ruby-identifier">leading</span>)
244:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
245:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">leading</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">leading</span>
246:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'TL'</span>, <span class="ruby-identifier">leading</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
247:       <span class="ruby-keyword kw">end</span>
248: 
249:       <span class="ruby-keyword kw">self</span>
250:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000606" class="method-detail">
        <a name="M000606"></a>

        <div class="method-heading">
          <a href="#M000606" class="method-signature">
          <span class="method-name">set_text_pos</span><span class="method-args">(tx,ty)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000606-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000606-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 236</span>
236:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_text_pos</span>(<span class="ruby-identifier">tx</span>,<span class="ruby-identifier">ty</span>)
237:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
238:       <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Td'</span>, <span class="ruby-identifier">tx</span>, <span class="ruby-identifier">ty</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
239:       
240:       <span class="ruby-keyword kw">self</span>
241:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000608" class="method-detail">
        <a name="M000608"></a>

        <div class="method-heading">
          <a href="#M000608" class="method-signature">
          <span class="method-name">set_text_rendering</span><span class="method-args">(rendering)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000608-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000608-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 252</span>
252:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_text_rendering</span>(<span class="ruby-identifier">rendering</span>)
253:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
254:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rendering</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">rendering_mode</span>
255:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Tr'</span>, <span class="ruby-identifier">rendering</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
256:       <span class="ruby-keyword kw">end</span>
257: 
258:       <span class="ruby-keyword kw">self</span>
259:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000609" class="method-detail">
        <a name="M000609"></a>

        <div class="method-heading">
          <a href="#M000609" class="method-signature">
          <span class="method-name">set_text_rise</span><span class="method-args">(rise)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000609-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000609-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 261</span>
261:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_text_rise</span>(<span class="ruby-identifier">rise</span>)
262:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
263:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rise</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">text_rise</span>
264:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Ts'</span>, <span class="ruby-identifier">rise</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
265:       <span class="ruby-keyword kw">end</span>
266:       
267:       <span class="ruby-keyword kw">self</span>
268:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000610" class="method-detail">
        <a name="M000610"></a>

        <div class="method-heading">
          <a href="#M000610" class="method-signature">
          <span class="method-name">set_text_scale</span><span class="method-args">(scaling)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000610-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000610-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 270</span>
270:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_text_scale</span>(<span class="ruby-identifier">scaling</span>)
271:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
272:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">scale</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">scaling</span>
273:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Tz'</span>, <span class="ruby-identifier">scaling</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
274:       <span class="ruby-keyword kw">end</span>
275: 
276:       <span class="ruby-keyword kw">self</span>
277:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000611" class="method-detail">
        <a name="M000611"></a>

        <div class="method-heading">
          <a href="#M000611" class="method-signature">
          <span class="method-name">set_text_word_spacing</span><span class="method-args">(word_spacing)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000611-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000611-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 279</span>
279:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">set_text_word_spacing</span>(<span class="ruby-identifier">word_spacing</span>)
280:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
281:       <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">word_spacing</span> <span class="ruby-operator">!=</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">word_spacing</span>
282:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'Tw'</span>, <span class="ruby-identifier">word_spacing</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
283:       <span class="ruby-keyword kw">end</span>
284:       
285:       <span class="ruby-keyword kw">self</span>
286:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000603" class="method-detail">
        <a name="M000603"></a>

        <div class="method-heading">
          <a href="#M000603" class="method-signature">
          <span class="method-name">write</span><span class="method-args">(text, attr = {})</span>
          </a>
        </div>
      
        <div class="method-description">
          <p>
Adds text to the content stream with custom formatting attributes.
</p>
<table>
<tr><td valign="top"><em>text</em>:</td><td><a href="Text.html">Text</a> to <a
href="ContentStream.html#M000603">write</a>.

</td></tr>
<tr><td valign="top"><em>attr</em>:</td><td>Formatting attributes.

</td></tr>
</table>
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000603-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000603-source">
<pre>
     <span class="ruby-comment cmt"># File origami/graphics/xobject.rb, line 181</span>
181:     <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">write</span>(<span class="ruby-identifier">text</span>, <span class="ruby-identifier">attr</span> = {})
182:       <span class="ruby-identifier">load!</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@instructions</span>.<span class="ruby-identifier">nil?</span>
183: 
184:       <span class="ruby-identifier">x</span>,<span class="ruby-identifier">y</span>       = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:x</span>], <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:y</span>] 
185:       <span class="ruby-identifier">font</span>      = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:font</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_FONT</span>
186:       <span class="ruby-identifier">size</span>      = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:size</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_SIZE</span>
187:       <span class="ruby-identifier">leading</span>   = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:leading</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LEADING</span>
188:       <span class="ruby-identifier">color</span>     = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:color</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:fill_color</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_STROKE_COLOR</span>
189:       <span class="ruby-identifier">stroke_color</span> = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:stroke_color</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_STROKE_COLOR</span>
190:       <span class="ruby-identifier">line_width</span>    = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:line_width</span>] <span class="ruby-operator">||</span> <span class="ruby-constant">DEFAULT_LINEWIDTH</span>
191:       <span class="ruby-identifier">word_spacing</span>  = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:word_spacing</span>]
192:       <span class="ruby-identifier">char_spacing</span>  = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:char_spacing</span>]
193:       <span class="ruby-identifier">scale</span>     = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:scale</span>]
194:       <span class="ruby-identifier">rise</span>      = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:rise</span>]
195:       <span class="ruby-identifier">rendering</span> = <span class="ruby-identifier">attr</span>[<span class="ruby-identifier">:rendering</span>]
196: 
197:       <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'ET'</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>) <span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">x</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">y</span>) <span class="ruby-keyword kw">and</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">is_in_text_object?</span>
198: 
199:       <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@gs</span>.<span class="ruby-identifier">text_state</span>.<span class="ruby-identifier">is_in_text_object?</span> 
200:         <span class="ruby-ivar">@instructions</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">PDF</span><span class="ruby-operator">::</span><span class="ruby-constant">Instruction</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'BT'</span>).<span class="ruby-identifier">update_state</span>(<span class="ruby-ivar">@gs</span>)
201:       <span class="ruby-keyword kw">end</span>
202: 
203:       <span class="ruby-identifier">set_text_font</span>(<span class="ruby-identifier">font</span>, <span class="ruby-identifier">size</span>)
204:       <span class="ruby-identifier">set_text_pos</span>(<span class="ruby-identifier">x</span>, <span class="ruby-identifier">y</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">x</span> <span class="ruby-keyword kw">or</span> <span class="ruby-identifier">y</span>
205:       <span class="ruby-identifier">set_text_leading</span>(<span class="ruby-identifier">leading</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">leading</span>
206:       <span class="ruby-identifier">set_text_rendering</span>(<span class="ruby-identifier">rendering</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rendering</span>
207:       <span class="ruby-identifier">set_text_rise</span>(<span class="ruby-identifier">rise</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">rise</span>
208:       <span class="ruby-identifier">set_text_scale</span>(<span class="ruby-identifier">scale</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">scale</span>
209:       <span class="ruby-identifier">set_text_word_spacing</span>(<span class="ruby-identifier">word_spacing</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">word_spacing</span>
210:       <span class="ruby-identifier">set_text_char_spacing</span>(<span class="ruby-identifier">char_spacing</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">char_spacing</span>
211:       <span class="ruby-identifier">set_fill_color</span>(<span class="ruby-identifier">color</span>)
212:       <span class="ruby-identifier">set_stroke_color</span>(<span class="ruby-identifier">stroke_color</span>) 
213:       <span class="ruby-identifier">set_line_width</span>(<span class="ruby-identifier">line_width</span>)
214: 
215:       <span class="ruby-identifier">write_text_block</span>(<span class="ruby-identifier">text</span>)
216:      
217:       <span class="ruby-keyword kw">self</span>
218:     <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>